/*
* HighPrecisionTimer.java
* Copyright (C) 2005
* 
* $Id: HighPrecisionTimer.java,v 1.1 2005/07/01 14:11:00 hzi Exp $
*/
using System;
//UPGRADE_TODO: The type 'sun.misc.Perf' could not be found. If it was not included in the conversion, there may be compiler issues. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1262'"
using Perf = sun.misc.Perf;
namespace Suake2.UI.sys
{
	
	
	
	
	class HighPrecisionTimer:Timer
	{
		private void  InitBlock()
		{
			f = 1000.0 / perf.highResFrequency();
		}
		
		private Perf perf = Perf.getPerf();
		//UPGRADE_NOTE: The initialization of  'f' was moved to method 'InitBlock'. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1005'"
		private double f;
		private long base_Renamed;
		
		internal HighPrecisionTimer()
		{
			InitBlock();
			base_Renamed = perf.highResCounter();
		}
		
		public override long currentTimeMillis()
		{
			long time = perf.highResCounter();
			long delta = time - base_Renamed;
			if (delta < 0)
			{
				delta += System.Int64.MaxValue + 1;
			}
			//UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
			return (long) (delta * f);
		}
	}
}